import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Set;


/**
 * Created by safe on 2017-03-28.
 */
public class Init {


    public static void main( String [ ] args ) throws IOException
    {
        String classPath=Init.class.getResource("/").getFile();
        FileReader fin = new FileReader(classPath+"case99.txt" );
        BufferedReader bin = new BufferedReader( fin );
        String oneLine;
        oneLine = bin.readLine( );

        //第一行
        System.out.println("第一行"+oneLine);
        String[] st=oneLine.split(" ");
        //if (st.length!=3) System.out.println("error!" );
        int nodeCount = Integer.parseInt(st[0]);
        int edgeCount = Integer.parseInt(st[1]);
        int consumerConut = Integer.parseInt(st[2]);

        oneLine = bin.readLine( );
        System.out.println("空行"+oneLine);

        oneLine = bin.readLine( );
        int serverCost=Integer.parseInt(oneLine);
        System.out.println("服务器成本"+oneLine);

        oneLine = bin.readLine( );
        System.out.println("空行"+oneLine);

        Graph gr=new Graph(nodeCount,edgeCount,consumerConut);
        for (int i = 0; i < edgeCount; i++) {
            oneLine = bin.readLine( );
            System.out.println("普通节点"+oneLine);
            st=oneLine.split(" ");
            int begin = Integer.parseInt(st[0]);
            int end = Integer.parseInt(st[1]);
            int edge = Integer.parseInt(st[2]);
            int cost = Integer.parseInt(st[3]);
            gr.firstArray[begin].addEdge(end, edge,cost);
            gr.firstArray[end].addEdge(begin, edge,cost);

        }
        System.out.println(gr.firstArray);

        oneLine = bin.readLine( );
        System.out.println("空行"+oneLine);

        for (int i = 0; i < consumerConut; i++) {
            oneLine = bin.readLine( );
            st=oneLine.split(" ");
            System.out.println("消费节点"+oneLine);
            int consuID = Integer.parseInt(st[0]);
            int nodeID = Integer.parseInt(st[1]);
            int need = Integer.parseInt(st[2]);

            gr.consumerArray[consuID].put(nodeID,need);
        }
        System.out.println(gr.consumerArray);

        bin.close();

        //多线程并发寻找???
        for (int i = 0; i <consumerConut ; i++) {
            Set<Integer> keySet = gr.consumerArray[i].keySet();
            for (Integer key:keySet) {
                //System.out.println(gr.BFS(key,serverCost));

            }

        }
        gr.print_Path(0,111);
        gr.DFS();

    }
}
